;;;(setprevdwg): preserves the path and filename of the "previous" drawing (current drawing at the time it is run)
;;;(getprevdwg); recalls the last value preserved as the "previous" drawing (current drawing the last time (setprevdwg) was run).
;;;
;;;	Author:	Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;		http://paracadd.com
;;;		All rights reserved.
;;;
;;;		COPYRIGHT: 9-18-2010
;;;		   EDITED: 4-9-2012
;;;
(DEFUN setprevdwg ()
  (vl-load-com)
  (IF vl-bb-set
    (PROGN
      (IF (AND selected-xref (SETQ zxrs-data (VL-BB-REF 'bb_zxrs_data)))
        (IF (SETQ this-zxrs (ASSOC (STRCASE selected-xref) zxrs-data))
          (PROGN
            (SETQ this-zxrs (LIST (CAR this-zxrs)(STRCASE (STRCAT (GETVAR "DWGPREFIX") (GETVAR "DWGNAME")))))
            (SETQ zxrs-data (SUBST this-zxrs (ASSOC (STRCASE selected-xref) zxrs-data) zxrs-data))
            (VL-BB-SET 'bb_zxrs_data zxrs-data)
          )
          (PROGN
            (SETQ zxrs-data (APPEND (LIST (LIST (STRCASE selected-xref) (STRCASE (STRCAT (GETVAR "DWGPREFIX") (GETVAR "DWGNAME"))))) zxrs-data))
            (VL-BB-SET 'bb_zxrs_data zxrs-data)
          )
        )
        (PROGN
          (IF selected-xref
            (PROGN
              (SETQ zxrs-data (LIST (LIST (STRCASE selected-xref) (STRCASE (STRCAT (GETVAR "DWGPREFIX") (GETVAR "DWGNAME"))))))
              (VL-BB-SET 'bb_zxrs_data zxrs-data)
            )
            (VL-BB-SET 'bb_zxrs_data NIL)
          )
        )
      )
    )
    (PROGN
      (PRINC (STRCAT "\nCannot preserve this drawing's identity for \"previous drawing\" recall! "))
      (PRINC)
    )
  )
  (PRINC)
)
(DEFUN getprevdwg ()
  (vl-load-com)
  (IF
    (AND
      vl-bb-ref
      (SETQ zxrs-data (VL-BB-REF 'bb_zxrs_data))
      (SETQ this-zxrs (ASSOC (STRCASE (STRCAT (GETVAR "DWGPREFIX") (GETVAR "DWGNAME"))) zxrs-data))
    )
    (SETQ bb-prev-dwg (CADR this-zxrs))
    (PROGN
      (IF zxrs-data
        (PROGN
;;;          (FOREACH n zxrs-data (PRINC "\n")(PRINC n)(PRINC))
          (PRINC (STRCAT "\nThere is no \"previous\" drawing associated with this drawing. "))
        )
      )
      (PRINC)
    )
  )
  (PRINC)
)
